package com.longma.server.constant.enums;

/**
 * @Author： zy
 * @Date：2021/5/21
 * @Description：开关状态
 */
public enum SwitchEnum implements IBaseEnum<Integer> {
    //开
    OPEN(0,"开"),

    //关
    CLOSE(1,"关");

    /**
     * 值
     */
    private int value;

    /*
     * 描述信息
     */
    private String desc;

    /**
     * 构造函数
     */
    SwitchEnum(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    /**
     * 通过值转为枚举类型
     */
    public static SwitchEnum fromValue(int value) {
        switch (value) {
            case 0:
                return OPEN;
            case 1:
                return CLOSE;
            default:
                throw new IllegalArgumentException();
        }
    }

    /**
     * 获取值
     */
    @Override
    public Integer getValue() {
        return this.value;
    }

    @Override
    public String getDesc() {
        return  this.desc;
    }

}

